// pages/cate/cate.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    catelist:[],
    cateid:0,
    p:1,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.showLoading({
      title: '加载中',
    })
    let cateid=options.id
    this.setData({
      cateid:cateid
    })
    wx.request({
      url: `https://app.vmovier.com/apiv3/post/getPostInCate?p=1&size=10&cateid=${cateid}`,
      // url:"https://app.vmovier.com/apiv3/post/getPostInCate?p=1&size=10&cateid=8",
      success:res=>{
        this.setData({
          catelist:res.data.data
        })
        wx.hideLoading({
          success: (res) => {},
        })
      }
    })
  },

  onReachBottom(){
    let p=this.data.p;
        ++p;
    this.setData({
      p:p
    });
    wx.showLoading({
      title: '加载中',
    })
    let cateid=this.data.cateid;
    wx.request({
      url: `https://app.vmovier.com/apiv3/post/getPostInCate?p=${p}&size=10&cateid=${cateid}`,
      success:res=>{
        let catelist=this.data.catelist.concat(res.data.data)
        this.setData({
          catelist:catelist
        })
        wx.hideLoading({
          success: (res) => {},
        })
      }
    })
},
onShareAppMessage: function (from,target,url) {
  return{
    title:"八四给你分享了一个精彩的视频！",
    imageUrl:this.data.catelist.image
  }
},
onShareTimeline(){
return{
  title:"分享到朋友圈",
  imageUrl:this.data.catelist.image
}
},
})